package com.chixing.ih.module.programmer.mapper;

import com.chixing.ih.common.IhRepository;
import com.chixing.ih.module.programmer.mapper.provider.EduExperMapperProvider;
import com.chixing.ih.module.programmer.pojo.EduExper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘岩
 * Date: 2020-09-29
 * Time: 16:44
 *
 * @version 1.0
 */
@Mapper
public interface EduExperMapper {

    @UpdateProvider(type = EduExperMapperProvider.class, method = "updateOne")
    int updateOne(EduExper eduExper);

    @SelectProvider(type = EduExperMapperProvider.class, method = "listAll")
    @Results(id = "eduExperMap", value = {
            @Result(id = true, column = "id", property = "id"),
            @Result(column = "user_id", property = "userId"),
            @Result(column = "begin_time", property = "beginTime"),
            @Result(column = "end_time", property = "endTime"),
            @Result(column = "school_name", property = "schoolName"),
            @Result(column = "perfession_name", property = "perfessionName"),
            @Result(column = "category", property = "category"),
            @Result(column = "awards_desc", property = "awardsDesc"),
            @Result(column = "create_time", property = "createTime")

    })
    List<EduExper> listAll(long userId);

    @InsertProvider(type = EduExperMapperProvider.class, method = "insertOne")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @ResultMap("eduExperMap")
    int insertOne(EduExper eduExper);

    @DeleteProvider(type = EduExperMapperProvider.class, method = "deleteOneById")
    int deleteOne(long id);


}
